package com.czl.elm.controller;


import com.czl.elm.service.IActivityService;
import com.czl.elm.util.ActionResult;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zuoleiChen
 * @since 2021-06-15
 */
@RestController
@RequestMapping("/activity")
public class ActivityController {
    @Autowired
    private IActivityService activityService;

    @ApiOperation("判断用户是否使用过")
    @GetMapping("/checkActivityUse")
    public ActionResult checkActivityUse(String activityTime){
        return activityService.checkActivityUse(activityTime);
    }

    @ApiOperation("获取盲盒的所有类型")
    @GetMapping("/getAllactivityType")
    public ActionResult getAllactivityType(){
        return activityService.getAllactivityType();
    }

    @ApiOperation("获取订单对象")
    @GetMapping("/getActivityOrder")
    public ActionResult getActivityOrder(String redParperId){
        return activityService.getActivityOrder(redParperId);
    }

    @ApiOperation("生成9个随机的盲盒")
    @PostMapping("/createActivityBoxes")
    public ActionResult createActivityBoxes(String activityTime,String shopLabel){
        return activityService.createActivityBoxes(activityTime,shopLabel);
    }

    @ApiOperation("生成活动订单与优惠券")
    @GetMapping("/createActivityRedparper")
    public ActionResult createActivityRedparper(Integer shopId,String activityTime,String redShopParperId,String shopLabel,Integer chooseIndex){
        return activityService.createActivityRedparper(shopId,activityTime,redShopParperId,shopLabel,chooseIndex);
    }

    @ApiOperation("商家入驻盲盒活动")
    @GetMapping("/createShopActivityRedparper")
    public ActionResult createShopActivityRedparper(Integer shopId){
        return activityService.createShopActivityRedparper(shopId);
    }

    @ApiOperation("获取该用户在改店铺是否有可用的盲盒满减券")
    @GetMapping("/getActivityByShop")
    public ActionResult getActivityByShop(Integer shopId){
        return activityService.getActivityByShop(shopId);
    }

}
